# -*- conding:utf-8 -*-
from Crypto.Cipher import ARC4
from binascii import b2a_hex, a2b_hex
import json
import hashlib
from urllib import parse
import base64
import sys, os, hashlib, time, base64
import rc4
from Crypto.Cipher import ARC4
import binascii
import io

rc4_data = {
    "device_token": "6f8da3bce54b5dd452a915aed15a7ee19089a018",
    "vertype": "801",
    "plat": "android",
    "mobile_model": "android9",
    "version": "2.2.0",
    "token": "ODkyN1kvV0dKMUlEL1pERVN0ZE5OZVlmT0psRXI5SEtvOGx1NmUvVnFyU1YzVmpGSHd1d2NKY3hWeDIyMWpOUnFRR2IxdFhYbWg4clNraVkwK2x6azdvNWdSK3RxN2J5cUN3YkRiR3R0VkV0ZTJybEVkTFNZRUxEb2hNMFEvR24rZVg3Z1RRdzUzb1pjV25nblpIWWRLOUZTaURwck5BeUdFU01GMlRUR0tFb0RVSjByOEVBYXJjcFhLSTJzUTo="
}
data = {"youpin_version": "2.2.0",
        "youpin_data": "bbPP6SHc0lljuHqwTAtlyFJT3uI9FEr4kWimbAoaQKDkTtiZLkMbmYKIDmkaOYNRuWuSTdyrZIJJ\n1yfTH+mhz0ZYmm5yusMKCbj2q+98gY8l8Zg95egL1PszWIckcAwfbhlWkhIvAsdfrZWdQ+28GWSN\nT\/RQ8+3zKtSQHORNDrSibGy1yv8LezyifNK3sBQdE23tOz6igG+Xr8Qlh308trdeh6EZh3IcOwFF\nj0eUNj5rpfcTCknF9W\/4Kbu27JYF+2ATHoIuavAuVnyWy8UBThXQmRTIpkKJLbtP38xTEE9wtxWl\nUIGT8iQG8GwTsZRFDVo\/jvXuoixBvWjYA1NepRKbf5jNB4nQuGTkdo6p7+LF7MrNwOvcw6CllEhI\nSBVldQ+zPkVJZkEe3nLGdjqr6IVJnJit0apOMkr6NBQp6BEQxEbr7tCNSalgIrigYLhC8dUuEyyL\nWMPxy8Huc+s7Aiq+FlGA7BLANKU6SmpsQXFR7c3fpx46wAjGwGnuKcckBmMm1vkl5\/DZT0ZynRPX\nHTllekFSE2CRgOjogwi8KzuvpVU=\n"}

rc4_decode = "bZubrHKI0gck/jH/CzB00VBV1Z9zWwOrmXL4Lw8eG6GwSdjPLxIbzoWNU2waaocMuWuSH93/YNpOinuDFuih1Atii3ZwtsMKCbj2q+98gY8n65A89uYFrrdyDIU8IgEQfkkD21RsQIFArZ6QDaTpVCvJCrofpq37KNW9HuJNUvqsdDry2eIGZj3pIsmnsiwTA2/hOzyomXmQ4pAl8hl1/dddwudtmxx3VnQJ6H/KLR5X0YMDckO00UzgdL2UitYS4nUPR5QnL/YkQ1LptfIRDQzkiQHwwyuDCIRn0apIMQpiyhyWOPyW8DcU11Mns9VTImIUrOCPozAUnzLPKl0K+SaSdaPVHLXXvAPyBr2Bud3z3+j20rrZ3Nr0sjNZfA09Wy/TLyEbThU++3OSfyXSw59C+LnM9LFaU0bpIx9Jsw1t1GjLjLjtcYpUAN2RBaxez/0uEQvYGsHptLLFZ9V5fw+zEnr843nGB5QSaHNlRUNe7pusnExn9wz9xW7wVuY4MDIh0t0szrzUb0VUgh6tRh1ufl9UFRqfk963jSvfcUqyyG0JJU46rYL2NfcZhWw4aOd7Va2iHLg="
rc4_key = "2*s&3Hd#kd90"
json_encode = json.dumps(rc4_data).encode()
print(json_encode)
rc4_encode = rc4.rc4(str(json_encode), rc4_key)
print(rc4_encode)
base64_encode = base64.b64encode(rc4_encode.encode())
print(str(base64_encode)[2:-1])
# print(str(base64_encode, 'utf-8'))
# b = str(base64_encode, 'utf-8')
# base64_encode = base64.b64encode(a.encode())
# print(str(base64_encode, 'utf-8'))
# base64_decode = base64.b64decode(str(base64_encode, 'utf-8'))
# print(base64_decode)
# base64.decodebytes()
